// 自定义水域材质（简化版）
import * as Cesium from 'cesium'

export function addWaterPrimitive(viewer, options = {}) {
  const waterMaterial = Cesium.Material.fromType('Water')
  const primitive = viewer.scene.primitives.add(
    new Cesium.Primitive({
      geometryInstances: new Cesium.GeometryInstance({
        geometry: new Cesium.RectangleGeometry({
          rectangle: Cesium.Rectangle.fromDegrees(
            options.west || 114.3,
            options.south || 30.6,
            options.east || 114.4,
            options.north || 30.7
          ),
        }),
      }),
      appearance: new Cesium.EllipsoidSurfaceAppearance({
        material: waterMaterial,
      }),
    })
  )
  return primitive
}
